package com.fdq.demo.tool;

import com.alibaba.excel.EasyExcel;
import com.fdq.demo.entity.Student;
import org.springframework.beans.BeanUtils;

import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;

/**
 * @author: 83778
 * @date: 2023-11-12 21:16
 * @desc:
 */
public class ExcelTool {

    public  static void exportDictToLocal(String jsonPath ,String outPath) {

        try {
            FileOutputStream fos = new FileOutputStream(outPath);
            List<Student> students = JsonToObjectTool.getStudentList(jsonPath);
            EasyExcel.write(fos, Student.class).sheet("数据字典").doWrite(students);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        exportDictToLocal("D:\\dev\\ideaProject\\fdq-dev\\src\\main\\resources\\static\\json\\4.json","D:\\a\\4.xlsx");
    }
}
